package com.gurumades.triggers.client;

public class TriggerRegistration {

	private Trigerable toTrigger;
	private TriggerRegistry registry;
	private Trigger source;
	private Object value;
	
	public TriggerRegistration(Trigerable eq, TriggerRegistry registry) {
		toTrigger = eq;
		this.registry = registry;
	}

	public TriggerRegistrationMaker when(Trigger source, Object value) {
		this.source = source;
		this.value = value;
		return new TriggerRegistrationMaker();
	}

	public class TriggerRegistrationMaker{

		public void make(boolean what) {
			TriggerChangeComparator comparator = StandardComparator.instance();
			registry.register(toTrigger, source, value,comparator, what);
		}
		
		public void make() {
			make(true);
		}
		
	}
}
